Socket
Socket
Sign inDemoInstall

get-video-duration

Package Overview
Dependencies
25
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    get-video-duration

Get the duration of a video file


Version published
Weekly downloads
9K
decreased by-14%
Maintainers
1
Install size
74.4 MB
Created
Weekly downloads
 

Readme

Source

get-video-duration

NPM version Build Status Maintainability Test Coverage License NPM bundle size (minified) Downloads

Get the duration of video files/streams with ffprobe.

Install

$ npm install --save get-video-duration

Usage

const { getVideoDurationInSeconds } = require('get-video-duration')

// From a local path...
getVideoDurationInSeconds('video.mov').then((duration) => {
  console.log(duration)
})

// From a URL...
getVideoDurationInSeconds(
  'http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4'
).then((duration) => {
  console.log(duration)
})

// From a readable stream...

const fs = require('fs')
const stream = fs.createReadStream('video.mov')

getVideoDurationInSeconds(stream).then((duration) => {
  console.log(duration)
})

// If you need to customize the path to ffprobe...
getVideoDurationInSeconds('video.mov', '/path/to/ffprobe').then((duration) => {
  console.log(duration)
})

License

MIT. Based on get-video-dimensions.

Keywords

FAQs

Last updated on 09 May 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc